package gupao.concurrency.kms;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

public class SimpleValidateCpuRatio {

    private static final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();

    public static void printThreadCpuRatio(){
    }

    static long getThreadCPUTime(long threadId) {
        long time = threadBean.getThreadCpuTime(threadId);
        /* thread of the specified ID is not alive or does not exist */
        return time == -1 ? 0 : time;
    }
}
